<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!doctype html>
<html>
<head>

    <link rel="stylesheet" type="text/css" href="../lib/pagination/style/pagination.css"/>
    <link rel="stylesheet" type="text/css" href="/css/base/base.css?20201106.1" />
    <link rel="stylesheet" type="text/css" href="/css/commonTheme/${sessionScope.InterfaceModel}/commonTheme.css"/>
    <link rel="stylesheet" href="/lib/laydate/need/laydate.css">
    <script src="/js/common/language.js"></script>
    <script type="text/javascript" src="/js/jquery/jquery-1.9.1.js"></script>
    <script src="/lib/jquery.form.min.js"></script>
    <script src="/js/jquery/jquery.cookie.js"></script>
    <script src="/lib/layer/layer.js?20201106"></script>
    <script src="/js/base/base.js"></script>
    <script src="/lib/laydate/laydate.js"></script>
    <script type="text/javascript" src="/js/base/tablePage.js"></script>
    <script src="/lib/pagination/js/jquery.pagination.min.js" type="text/javascript" charset="utf-8"></script>
    <link rel="stylesheet" href="/css/workflow/flowrun/datagrid.css">
    <link rel="stylesheet" href="/css/workflow/flowrun/easyui.css">
    <link rel="stylesheet" href="/css/workflow/flowrun/icon.css">
    <link rel="stylesheet" type="text/css" href="/css/workflow/flowrun/init.css">
    <link rel="stylesheet" type="text/css" href="/css/workflow/flowrun/package.css">
    <title>高级查询</title>
    <style>
        #boxform table tr{
            border: none;
        }
        .TableHeader{
            background: #fff;
        }
        #pagediv table tr td{
            text-align: left !important;
            padding: 15px 10px !important;
        }
        #pagediv table tr th{
            text-align: left;
            padding: 10px !important;
        }
        .pagediv .page-top-inner-layer{
            height: 62px;
        }
    </style>

</head>
<body style="overflow:auto;padding-left: 10px;padding-right: 10px">
<div id="boxform">
    <div id="topbar" class="topbar clearfix">
        <div class="fl left">
            <img id="img1" class="title_img" src="/img/workflow/flowRun/icon_gzltjcx.png">
            <span class="title">工作流高级查询 </span>（请指定查询条件 ）
        </div>
        <div class="fr right">
            <!-- <input type="button" style="display: none;" id="returnSearch" class="btn-win-white" value="返回查询" onclick="backTo()" /> -->
            <input type="button" value="返回" class="btn-win-white" onclick="seniorQuery();">
        </div>
    </div>

    <div class="">
        <form method="post" id="form1" name="form1" role="form" class="form-inline" enctype="multipart/form-data">

            <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            </div>
            <table class="TableBlock_page">
                <tbody>
                <tr style="background:#f0f0f0;display:none">
                    <td nowrap="" class="TableHeader" height="25" colspan="3"><h5> 选择查询模板&nbsp;&nbsp;
                        <small><a href="javascript:newQueryTpl('1');"> 自定义模板  </a></small></h5>
                    </td>
                </tr>
                <tr style="">
                    <td nowrap="" class="TableHeader" height="25" colspan="3">
                        <img src="/img/workflow/flowRun/icon_fenzu.png" alt="" style="vertical-align:middle;">
                        <b style="color: #0050aa">工作流程基本属性</b>
                    </td>
                </tr>
                <tr>
                    <td nowrap="" class="TableContent" style="width:33%;text-indent: 15px"><h6><label for="flowStatus">工作流状态：</label></h6></td>
                    <td class="TableData" colspan="2">
                        <select id="flowStatus" name="flowStatus" class="form-control" style="width:200px;height:23px">
                            <option value="0">所有</option>
                            <option value="2">执行中</option>
                            <option value="1">已结束</option>
                        </select>
                    </td>

                </tr>
                <tr>
                    <td nowrap="" class="TableContent" style="text-indent: 15px"><h6><label for="flowQueryType">查询范围：</label></h6></td>
                    <td class="TableData" colspan="2">
                        <select id="flowQueryType" name="flowQueryType" class="form-control" onchange="set_user(this);" style="width:200px;height:23px">
                            <option value="0">所有</option>
                            <option value="1">我发起的</option>
                            <option value="2">我经办的</option>
                            <%--<option value="3">我管理的</option>--%>
                            <%--<option value="4">我关注的</option>--%>
                            <%--<option value="5">我查阅的</option>--%>
                            <option value="6">指定发起人</option>
                        </select>
                    </td>
                </tr>
                <tr id="set_user_tr" style="display: none">
                    <td nowrap="" class="TableContent" style="text-indent: 15px"><h6><label for="beginUserName">流程发起人：</label></h6></td>
                    <td nowrap="" class="TableData" colspan="2">
                        <input type="hidden" name="beginUserId" id="beginUserId" required="true" value="">
                        <input name="beginUserName" id="beginUserName" style="width:198px;height: 20px;border: 1px solid #dadada;" wrap="yes" readonly="">
                        <span class="addSpan">
					   <img src="/img/workflow/flowRun/icon_select.png" onclick="selectUser(beginUserName,beginUserId);" value="选择">
					   &nbsp;&nbsp;
					   <img src="/img/workflow/flowRun/icon_cancel.png" onclick="empty(beginUserName,beginUserId);" value="清空">
				</span>
                    </td>
                </tr>

                <tr>
                    <td nowrap="" class="TableContent" style="text-indent: 15px"><p class="text-primary"></p><h6><label for="runNameRelation">名称/文号：</label></h6>
                    </td><td nowrap="" class="TableData" colspan="2">
                    <select name="runNameRelation" id="runNameRelation" class="form-control" style="width:200px;height:23px">
                        <option value="1">等于</option>
                        <%--<option value="2">大于</option>--%>
                        <%--<option value="3">小于</option>--%>
                        <%--<option value="4">大于等于</option>--%>
                        <%--<option value="5">小于等于</option>--%>
                        <option value="6">不等于</option>
                        <option value="7">开始为</option>
                        <option value="8">包含</option>
                        <option value="9">结束为</option>
                    </select>
                    <span><input type="text" name="runName" id="runName" value="" style="width:300px;" class="form-control"></span>
                </td>
                </tr>
                <tr>
                    <td nowrap="" class="TableContent" style="text-indent: 15px"><h6><label for="prcsDate1">流程开始日期范围：</label></h6></td>
                    <td class="TableData" colspan="2">
                        <p><input type="text" name="beginDate" id="prcsDate1" size="10" class="Wdate form-control" style="width:120px;height: 20px" value="" readonly="" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})">
                            &nbsp;至&nbsp;<input type="text" name="endDate" id="prcsDate2" size="10" class="Wdate form-control" style="width:120px;height: 20px" value="" readonly="" onclick="minfun($(this))">
                            <a href="javascript:emptyDate('0');" class="orgClear" onclick="emptyDate('0');">清空</a>&nbsp;
                            <select name="dateRange" id="dateRange" class="form-control" onchange="dateChange(this.value,'1')" style="width:200px;height:23px">
                                <option value="0">快捷选择</option>
                                <option value="1">今日</option>
                                <option value="2">昨日</option>
                                <option value="3">本周</option>
                                <option value="4">上周</option>
                                <option value="5">本月</option>
                                <option value="6">上月</option>
                            </select>
                        </p>
                    </td>
                </tr>
                <tr style="display:none" id="endTimeArea">
                    <td nowrap="" class="TableContent" style="text-indent: 15px"><h6><label for="prcsDate1">流程结束日期范围：</label></h6></td>
                    <td class="TableData" colspan="2">
                        <p>从<input type="text" name="endDate1" id="endDate1" size="10" class="SmallInput" value="" onclick="WdatePicker()">
                            至<input type="text" name="endDate2" id="endDate2" size="10" class="SmallInput" value="" onclick="WdatePicker()">
                            <a href="javascript:emptyDate('1');" class="orgClear" onclick="emptyDate('1');">清空</a>&nbsp;
                            <select name="dateRange1" id="dateRange1" class="form-control" onchange="dateChange(this.value,'2')">
                                <option value="0">快捷选择</option>
                                <option value="1">今日</option>
                                <option value="2">昨日</option>
                                <option value="3">本周</option>
                                <option value="4">上周</option>
                                <option value="5">本月</option>
                                <option value="6">上月</option>
                            </select>
                        </p>
                    </td>
                </tr>

                <tr style="">
                    <td nowrap="" class="TableHeader" height="25" colspan="3">

                        <img src="/img/workflow/flowRun/icon_fenzu.png" alt="" style="vertical-align:middle;">
                        <b style="color: #0050aa">表单数据条件</b>&nbsp;&nbsp;<a href="javascript:dataShowHide()">显示/隐藏条件</a>
                    </td>
                </tr>
                </tbody><tbody id="queryItem" style="display: none;">
            <tr>
                <td nowrap="" class="TableData" style="text-indent: 15px"><label for="relation_20">[20] 申请时间：</label></td>
                <td nowrap="" class="TableData" colspan="2">
                    <select style="width:200px;height:23px;" id="relation_20" name="relation_20" class="form-control" onchange="hide_item(this,'xmacro');">
                        <option value="1">等于</option>
                        <option value="6">不等于</option>
                        <option value="7">开始为</option>
                        <option value="8" selected="">包含</option>
                        <option value="9">结束为</option>
                        <option value="10">为空</option>
                    </select>&nbsp;
                    <input style="width: 300px;height: 20px" id="DATA_20" name="DATA_20" type="text" size="30" class="form-control">
                </td>
            </tr>

            <tr>
                <td nowrap="" class="TableData" style="text-indent: 15px"><label for="relation_3">[3] 姓名：</label></td>
                <td nowrap="" class="TableData" colspan="2">
                    <select style="width:200px;height:23px;" id="relation_3" name="relation_3" class="form-control" onchange="hide_item(this,'xmacro');">
                        <option value="1">等于</option>
                        <option value="6">不等于</option>
                        <option value="7">开始为</option>
                        <option value="8" selected="">包含</option>
                        <option value="9">结束为</option>
                        <option value="10">为空</option>
                    </select>&nbsp;
                    <input style="width: 300px;height: 20px" id="DATA_3" name="DATA_3" type="text" size="30" class="form-control">
                </td>
            </tr>

            <tr>
                <td nowrap="" class="TableData" style="text-indent: 15px"><label for="relation_4">[4] 部门：</label></td>
                <td nowrap="" class="TableData" colspan="2">
                    <select style="width:200px;height:23px;" id="relation_4" name="relation_4" class="form-control" onchange="hide_item(this,'xmacro');">
                        <option value="1">等于</option>
                        <option value="6">不等于</option>
                        <option value="7">开始为</option>
                        <option value="8" selected="">包含</option>
                        <option value="9">结束为</option>
                        <option value="10">为空</option>
                    </select>&nbsp;
                    <input style="width: 300px;height: 20px" id="DATA_4" name="DATA_4" type="text" size="30" class="form-control">
                </td>
            </tr>

            <tr>
                <td nowrap="" class="TableData" style="text-indent: 15px"><label for="relation_6">[6] 请假类别：</label></td>
                <td nowrap="" class="TableData" colspan="2">
                    <select style="width:200px;height:23px;" id="relation_6" name="relation_6" class="form-control" onchange="hide_item(this,'xselect');">
                        <option value="1">等于</option>
                        <option value="10" selected="">为空</option>
                    </select>&nbsp;
                    <select defaultvalue="外出" id="DATA_6" name="DATA_6" title="请假类别" xtype="xselect"><option value="" selected=""></option><option selected="selected" value="外出">外出</option><option value="公事外出">公事外出</option><option value="其他">其他</option></select>
                </td>
            </tr>

            <tr>
                <td nowrap="" class="TableData" style="text-indent: 15px"><label for="relation_26">[26] 请假时间：</label></td>
                <td nowrap="" class="TableData" colspan="2">
                    <select style="width:200px;height:23px;" id="relation_26" name="relation_26" class="form-control" onchange="hide_item(this,'xfetch');">
                        <option value="1">等于</option>
                        <option value="6">不等于</option>
                        <option value="7">开始为</option>
                        <option value="8" selected="">包含</option>
                        <option value="9">结束为</option>
                        <option value="10">为空</option>
                    </select>&nbsp;
                    <input style="width: 300px;height: 20px" id="DATA_26" name="DATA_26" type="text" size="30" class="form-control">
                </td>
            </tr>

            <tr>
                <td nowrap="" class="TableData" style="text-indent: 15px"><label for="relation_7">[7] 请假开始日期：</label></td>
                <td nowrap="" class="TableData" colspan="2">
                    <select style="width:200px;height:23px;" id="relation_7" name="relation_7" class="form-control" onchange="hide_item(this,'xfetch');">
                        <option value="1">等于</option>
                        <option value="6">不等于</option>
                        <option value="7">开始为</option>
                        <option value="8" selected="">包含</option>
                        <option value="9">结束为</option>
                        <option value="10">为空</option>
                    </select>&nbsp;
                    <input style="width: 300px;height: 20px" id="DATA_7" name="DATA_7" type="text" size="30" class="form-control">
                </td>
            </tr>

            <tr>
                <td nowrap="" class="TableData" style="text-indent: 15px"><label for="relation_8">[8] 请假结束日期：</label></td>
                <td nowrap="" class="TableData" colspan="2">
                    <select style="width:200px;height:23px;" id="relation_8" name="relation_8" class="form-control" onchange="hide_item(this,'xfetch');">
                        <option value="1">等于</option>
                        <option value="6">不等于</option>
                        <option value="7">开始为</option>
                        <option value="8" selected="">包含</option>
                        <option value="9">结束为</option>
                        <option value="10">为空</option>
                    </select>&nbsp;

                    <input style="width: 300px;height: 20px" id="DATA_8" name="DATA_8" type="text" size="30" class="form-control">
                </td>
            </tr>

            <tr>
                <td nowrap="" class="TableData" style="text-indent: 15px"><label for="relation_9">[9] 事由：</label></td>
                <td nowrap="" class="TableData" colspan="2">
                    <select style="width:200px;height:23px;" id="relation_9" name="relation_9" class="form-control" onchange="hide_item(this,'xtextarea');">
                        <option value="1">等于</option>
                        <option value="6">不等于</option>
                        <option value="7">开始为</option>
                        <option value="8" selected="">包含</option>
                        <option value="9">结束为</option>
                        <option value="10">为空</option>
                    </select>&nbsp;
                    <input style="width: 300px;height: 20px" id="DATA_9" name="DATA_9" type="text" size="30" class="form-control">
                </td>
            </tr>

            <tr>
                <td nowrap="" class="TableData" style="text-indent: 15px"><label for="relation_10">[10] 部门经理姓名：</label></td>
                <td nowrap="" class="TableData" colspan="2">
                    <select style="width:200px;height:23px;" id="relation_10" name="relation_10" class="form-control" onchange="hide_item(this,'xmacro');">
                        <option value="1">等于</option>
                        <option value="6">不等于</option>
                        <option value="7">开始为</option>
                        <option value="8" selected="">包含</option>
                        <option value="9">结束为</option>
                        <option value="10">为空</option>
                    </select>&nbsp;
                    <input style="width: 300px;height: 20px" id="DATA_10" name="DATA_10" type="text" size="30" class="form-control">
                </td>
            </tr>

            <tr>
                <td nowrap="" class="TableData" style="text-indent: 15px"><label for="relation_11">[11] 部门经理签字时间：</label></td>
                <td nowrap="" class="TableData" colspan="2">
                    <select style="width:200px;height:23px;" id="relation_11" name="relation_11" class="form-control" onchange="hide_item(this,'xmacro');">
                        <option value="1">等于</option>
                        <option value="6">不等于</option>
                        <option value="7">开始为</option>
                        <option value="8" selected="">包含</option>
                        <option value="9">结束为</option>
                        <option value="10">为空</option>
                    </select>&nbsp;
                    <input style="width: 300px;height: 20px" id="DATA_11" name="DATA_11" type="text" size="30" class="form-control">
                </td>
            </tr>

            <tr>
                <td nowrap="" class="TableData" style="text-indent: 15px"><label for="relation_21">[21] 部门经理审核结果：</label></td>
                <td nowrap="" class="TableData" colspan="2">
                    <select style="width:200px;height:23px;" id="relation_21" name="relation_21" class="form-control" onchange="hide_item(this,'xselect');">
                        <option value="1">等于</option>
                        <option value="10" selected="">为空</option>
                    </select>&nbsp;
                    <select defaultvalue=" " id="DATA_21" name="DATA_21" title="部门经理审核结果" xtype="xselect"><option value="" selected=""></option><option selected="selected" value=" "></option><option value="同意">同意</option><option value="不同意">不同意</option></select>
                </td>
            </tr>

            <tr>
                <td nowrap="" class="TableData" style="text-indent: 15px"><label for="relation_12">[12] 人事部姓名：</label></td>
                <td nowrap="" class="TableData" colspan="2">
                    <select style="width:200px;height:23px;" id="relation_12" name="relation_12" class="form-control" onchange="hide_item(this,'xmacro');">
                        <option value="1">等于</option>
                        <option value="6">不等于</option>
                        <option value="7">开始为</option>
                        <option value="8" selected="">包含</option>
                        <option value="9">结束为</option>
                        <option value="10">为空</option>
                    </select>&nbsp;

                    <input style="width: 300px;height: 20px" id="DATA_12" name="DATA_12" type="text" size="30" class="form-control">
                </td>
            </tr>

            <tr>
                <td nowrap="" class="TableData" style="text-indent: 15px"><label for="relation_13">[13] 人事部审核时间：</label></td>
                <td nowrap="" class="TableData" colspan="2">
                    <select style="width:200px;height:23px;" id="relation_13" name="relation_13" class="form-control" onchange="hide_item(this,'xmacro');">
                        <option value="1">等于</option>
                        <option value="6">不等于</option>
                        <option value="7">开始为</option>
                        <option value="8" selected="">包含</option>
                        <option value="9">结束为</option>
                        <option value="10">为空</option>
                    </select>&nbsp;
                    <input style="width: 300px;height: 20px" id="DATA_13" name="DATA_13" type="text" size="30" class="form-control">
                </td>
            </tr>

            <tr>
                <td nowrap="" class="TableData" style="text-indent: 15px"><label for="relation_22">[22] 人事部审核结果：</label></td>
                <td nowrap="" class="TableData" colspan="2">
                    <select style="width:200px;height:23px;" id="relation_22" name="relation_22" class="form-control" onchange="hide_item(this,'xselect');">
                        <option value="1">等于</option>
                        <option value="10" selected="">为空</option>
                    </select>&nbsp;
                    <select defaultvalue=" " id="DATA_22" name="DATA_22" title="人事部审核结果" xtype="xselect"><option value="" selected=""></option><option selected="selected" value=" "></option><option value="同意">同意</option><option value="不同意">不同意</option></select>
                </td>
            </tr>

            <tr>
                <td nowrap="" class="TableData" style="text-indent: 15px"><label for="relation_16">[16] 总经理姓名：</label></td>
                <td nowrap="" class="TableData" colspan="2">
                    <select style="width:200px;height:23px;" id="relation_16" name="relation_16" class="form-control" onchange="hide_item(this,'xmacro');">
                        <option value="1">等于</option>
                        <option value="6">不等于</option>
                        <option value="7">开始为</option>
                        <option value="8" selected="">包含</option>
                        <option value="9">结束为</option>
                        <option value="10">为空</option>
                    </select>&nbsp;

                    <input style="width: 300px;height: 20px" id="DATA_16" name="DATA_16" type="text" size="30" class="form-control">
                </td>
            </tr>

            <tr>
                <td nowrap="" class="TableData" style="text-indent: 15px"><label for="relation_17">[17] 总经理审核时间：</label></td>
                <td nowrap="" class="TableData" colspan="2">
                    <select style="width:200px;height:23px;" id="relation_17" name="relation_17" class="form-control" onchange="hide_item(this,'xmacro');">
                        <option value="1">等于</option>
                        <option value="6">不等于</option>
                        <option value="7">开始为</option>
                        <option value="8" selected="">包含</option>
                        <option value="9">结束为</option>
                        <option value="10">为空</option>
                    </select>&nbsp;
                    <input style="width: 300px;height: 20px" id="DATA_17" name="DATA_17" type="text" size="30" class="form-control">
                </td>
            </tr>

            <tr>
                <td nowrap="" class="TableData" style="text-indent: 15px"><label for="relation_24">[24] 总经理审核结果：</label></td>
                <td nowrap="" class="TableData" colspan="2">
                    <select style="width:200px;height:23px;" id="relation_24" name="relation_24" class="form-control" onchange="hide_item(this,'xselect');">
                        <option value="1">等于</option>
                        <option value="10" selected="">为空</option>
                    </select>&nbsp;

                    <select defaultvalue=" " id="DATA_24" name="DATA_24" title="总经理审核结果" xtype="xselect"><option value="" selected=""></option><option selected="selected" value=" "></option><option value="同意">同意</option><option value="不同意">不同意</option></select>
                </td>
            </tr>

            <tr>
                <td nowrap="" class="TableData" style="text-indent: 15px"><label for="relation_27">[27] 备注：</label></td>
                <td nowrap="" class="TableData" colspan="2">
                    <select style="width:200px;height:23px;" id="relation_27" name="relation_27" class="form-control" onchange="hide_item(this,'xtextarea');">
                        <option value="1">等于</option>
                        <option value="6">不等于</option>
                        <option value="7">开始为</option>
                        <option value="8" selected="">包含</option>
                        <option value="9">结束为</option>
                        <option value="10">为空</option>
                    </select>&nbsp;
                    <input style="width: 300px;height: 20px" id="DATA_27" name="DATA_27" type="text" size="30" class="form-control">

                </td>
            </tr>

            <tr>
                <td nowrap="" class="TableData" style="text-indent: 15px"><h6><label for="condFormula">表单字段条件公式：</label></h6></td>
                <td nowrap="" class="TableData" colspan="2">
                    <p><input type="text" style="width:200px;height: 20px;" id="condFormula" name="condFormula" value="" size="35" class="form-control" onblur="check_condition_formula(this);">&nbsp;形如：([1] or [2]) and [3]</p>
                </td>
            </tr>

            </tbody>
                <tbody><tr align="center" class="TableFooter" style="display: none">
                    <td colspan="3" nowrap="" style="text-algin:center">
                        <input type="hidden" name="op" id="op">
                        <input type="hidden" value="" id="listView" name="listView">
                        <input type="hidden" value="" id="dispFld" name="dispFld">
                        <input type="hidden" value="" id="sumFld" name="sumFld">
                        <input type="hidden" value="" name="runId" id="runId">
                        <input type="hidden" value="" name="menuFlag" id="menuFlag">
                        <input type="hidden" value="" name="sid" id="sid">
                        <input type="hidden" value="" name="flowId" id="flowId">
                    </td>
                </tr>

                <tr style="">
                    <td nowrap="" class="TableHeader" height="25" colspan="3">

                        <img src="/img/workflow/flowRun/icon_fenzu.png" alt="" style="vertical-align:middle;">
                        <b style="color: #0050aa">统计相关</b>
                    </td>
                </tr>
                <tr>
                    <td nowrap="" class="TableContent" style="width:33%;text-indent: 15px"><h6><label for="flowStatus">分组字段：</label></h6></td>
                    <td class="TableData" colspan="2">
                        <select id="sort" name="sort" class="form-control" style="width:200px;height:23px">
                            <option value="fr.RUN_ID">流水号</option>
                            <option value="fr.RUN_NAME">流程名称/标题</option>
                            <option value="fr.END_FLAG">流程状态</option>
                            <option value="fr.BEGIN_TIME">流程开始日期</option>
                        </select>

                        <select id="order" name="order" class="form-control" style="width:100px;height:23px">
                            <option value="ASC">升序</option>
                            <option value="DESC">降序</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td class="TableContent" style="width:33%;text-indent: 15px"><h6><label for="flowStatus">统计字段：</label></h6>
                    </td>
                    <td class="TableData" colspan="2">
                        <table>
                            <tbody><tr>
                                <td><b>报表显示列</b></td>
                                <td width="50px"></td>
                                <td><b>字段备选</b></td>
                            </tr>
                            <tr>
                                <td>
                                    <select id="statistics_show" class="form-control" style="width:150px;height:200px" multiple="">

                                    </select>
                                    <input type="hidden" name="showFields" id="showFields">
                                    <input type="hidden" name="type" class="type" >
                                </td>
                                <td style="text-align:center">
                                    <p><button type="button" class="btn-win-white" onclick="$('#statistics_show option:selected').appendTo($('#statistics_hide'));">&gt;</button></p>
                                    <br>
                                    <p><button type="button" class="btn-win-white" onclick="$('#statistics_hide option:selected').appendTo($('#statistics_show'));">&lt;</button></p>
                                </td>
                                <td>
                                    <select id="statistics_hide" class="form-control" style="width:150px;height:200px" multiple="">
                                        <option value="fr.RUN_ID">流水号</option>
                                        <option value="fr.RUN_NAME">流程名称/标题</option>
                                        <option value="fr.END_FLAG">流程状态</option>
                                        <option value="fr.BEGIN_TIME">流程开始日期</option>
                                    </select>
                                </td>
                            </tr>
                            </tbody></table>
                        <h6>如需进行合计，请在“列表显示列”中选中，按住CTRL键可多选</h6>
                    </td>
                </tr>
                </tbody></table>

            <div style="text-align:center;padding:10px 0">
                <input type="button" value="查询" class="btn-win-white" onclick="my_submit1(1)">
                &nbsp;&nbsp;
                <input type="button" value="生成统计报表" class="btn-win-white" onclick="generate_report()" style="dispaly: none;">
            </div>
        </form>

    </div>
    <table id="datagrid" fit="true"></table>
</div>

<div id="toolbar" class="topbar clearfix" style="display:none;padding:10px">
    <div class="fl left">
        <span class="title">结果列表</span>
    </div>
    <div class="fr right">
        <input type="button" class="btn-win-white" value="返回查询" onclick="backTo()">
    </div>
</div>
<div id="pagediv" style="display: none">
    <div>
        <div class="pagediv" style="margin: 0 auto;width: 100%;margin-top: 40px;">
            <div class="page-top-outer-layer" style="width: 1550px">
                <div class="page-top-inner-layer">
                    <table style="width: 1550px" border="0" cellpadding="0" cellspacing="0">
                        <thead>
                        <tr>
                            <th style="width:29.915000000000003px"><input type="checkbox" name="checkbox" id="selectAll" ischecked="false"></th>
                            <th style="width:89.9px">流水号</th>
                            <th style="width:336.35px">工作名称/文号</th>
                            <th style="width:234.04999999999998px">开始时间</th>
                            <th style="width:234.04999999999998px">公共附件</th>
                            <th style="width:111.6px">状态</th>
                            <th style="">操作</th>
                        </tr>
                        </thead>
                    </table>
                </div>
            </div>
            <div class="page-bottom-outer-layer" style="width:1550px">
                <div class="page-bottom-inner-layer" style="width: 1550px; overflow-x: hidden;">
                    <table border="0" cellpadding="0" cellspacing="0" style="width: 1550px">
                        <tbody id="pageTbody">
                        <tr>
                            <td style="width: 29.915000000000003px"><input type="checkbox" name="checkbox" class="kx"></td>
                            <td style="width: 89.9px">8050</td>
                            <td style="width: 336.35px"><a class="wenhao" style="cursor: pointer;" href="javascript:void(0);" onclick="js_method($(this))" title="20180829" runid="8050" flowid="144" prcsid="1" flowstep="1"><span class="font-green" style="color:green">【普通】</span>20180829</a></td>
                            <td style="width: 234.04999999999998px">系理员</td>
                            <td style="width: 234.04999999999998px"><a class="wenhao" style="cursor: pointer;" onclick="bzlct($(this))" runid="8050" flowid="144">第1步:申请</a></td>
                            <td style="width: 111.6px">办理中</td>
                            <td style=""><a style="margin-right: 10px" data-i="0" href="javascript:;" class="editAndDelete0">主办</a><a style="margin-right: 10px" href="javascript:;" class="editAndDelete1" data-i="0">删除</a></td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="right">
                <!-- 分页按钮-->
                <div class="M-box3">
                </div>
            </div>
        </div>
    </div>
</div>

<div class="hideenHTML" style="display: none">

</div>
<div style="position: absolute; z-index: 100004; display: none; top: 222px; left: 504.641px;" lang="zh-cn"><iframe hidefocus="true" width="9" height="7" frameborder="0" border="0" scrolling="no" src="about:blank" style="width: 186px; height: 198px;"></iframe></div>
<script>

    function selectUser(name,id){
        user_id = "beginUserName";
        $.popWindow("../common/selectUser?0");
    }
    function empty(name,id){
        $('#beginUserId').val('');
        $('#beginUserName').val('').attr({
            'username':'',
            'dataid':'',
            'user_id':'',
            'userprivname':''
        });

    }
    function initPagination(totalData,pageSize,index){
        $('.M-box3').pagination({
            totalData:totalData,
            showData:pageSize,
            jump:true,
            coping:true,
            current: index,
            homePage:'首页',
            endPage:'末页',
            prevContent:'上页',
            nextContent:'下页',
            jumpBtn:'跳转',
            callback:function(index){
                ajaxsubmit(index.getCurrent(),function(pageCount){
                    initPagination(pageCount,10,index.getCurrent());
                });
            }
        });
    }
    /***********流程开始日期范围：***************/
    function minfun(e){
        var dataobj={istime: true, format: 'YYYY-MM-DD',min:queryTime(1)};
        laydate(dataobj);
    }
    function queryTime(type){
        if($('#prcsDate1').val() != ''){
            return $('#prcsDate1').val();
        }else{
            function p(s) {
                return s < 10 ? '0' + s: s;
            }
            var myDate = new Date();
            //获取当前年
            var year=myDate.getFullYear();
            //获取当前月
            var month=myDate.getMonth()+1;
            //获取当前日
            var date=myDate.getDate();
            var h=myDate.getHours();       //获取当前小时数(0-23)
            var m=myDate.getMinutes();     //获取当前分钟数(0-59)
            var s=myDate.getSeconds();
            var now=year+'-'+p(month)+"-"+p(date)+" "+p(h)+':'+p(m)+":"+p(s);
            if(type==undefined){
                return now;
            }else {
                return year+'-'+p(month)+"-"+p(date)
            }
        }

    }
    /***********生成统计报表：***************/
    function generate_report(){
        window.showField = [];//显示列
        window.showFieldDesc = [];//显示列
        $("#statistics_show option").each(function(i,obj){
            window.showField.push(obj.value);
            window.showFieldDesc.push(obj.innerHTML);
        });

        if($('#beginUserName').attr('user_id') != ''&&$('#beginUserName').attr('user_id') != undefined){
            $('#beginUserId').val($('#beginUserName').attr('user_id').split(',')[0]);//流程发起人
        }

        $('#showFields').val(window.showField.join(","));
        $('.type').val(1);//导出是1

        $('#form1').attr('action','/flowRun/toSeniorQuery');
        window.location.href = "/flowRun/toSeniorQuery?"+$("form").serialize()
//        $('#form1').ajaxSubmit({
//            dataType: 'json',
//            success:function (res) {
//                alert("提交成功！");
//            }
//        })
    }

    function set_user(obj){
        if($(obj).val()==6){
            $("#set_user_tr").show();
        }else{
            $("#set_user_tr").hide();
            $('#beginUserId').val('');
            $('#beginUserName').val('').attr({
                'username':'',
                'dataid':'',
                'user_id':'',
                'userprivname':''
            });
        }
    }
    function emptyDate(type){
        if(type=="0"){
            $("#prcsDate1").val("");
            $("#prcsDate2").val("");
        }
        if(type=="1"){
            $("#endDate1").val("");
            $("#endDate2").val("");
        }
    }

    function my_submit1(num){
        if($('#beginUserName').attr('user_id') != ''&&$('#beginUserName').attr('user_id') != undefined){
            $('#beginUserId').val($('#beginUserName').attr('user_id').split(',')[0]);//流程发起人
        }

        $('#form1').attr('action','/flowRun/toSeniorQuery');

        $('.type').val(0);//查询时0

        ajaxsubmit(num,function(totleNum){
            initPagination(totleNum,10,num);
        });
    }
    function ajaxsubmit(num,cb){
        $('#form1').ajaxSubmit({
            data:{
                page:num,
                pageSize: 10,
                useFlag: true
            },
            dataType: 'json',
            success:function (res) {
                var str = '';
                for(var i=0;i<res.obj.length;i++){
                    if((res.obj[i].all=='1' || res.obj[i].manage=='1')&& obj.endTime==undefined){
                        var str_end = '<a style="margin-right: 10px" data-i="0" href="javascript:;" class="editAndDelete1" onclick="editAndDelete1($(this))"  flowId="'+ res.obj[i].flowId + '" runId="'+ res.obj[i].runId + '">结束</a>'
                    }else{
                        var str_end = '';
                    }
                    if(res.obj[i].all=='1' || res.obj[i].manage=='1' || res.obj[i].monitor=='1'){
                        var str_cui = '<a style="margin-right: 10px" data-i="0" href="javascript:;" class="editAndDelete2" onclick="editAndDelete2($(this))"  flowId="'+ res.obj[i].flowId + '" runId="'+ res.obj[i].runId + '">催办</a>'
                    }else{
                        var str_cui = '';
                    }
                    if(res.obj[i].all=='1' || res.obj[i].manage=='1'){
                        var str_del = '<a style="margin-right: 10px" data-i="0" href="javascript:;" class="editAndDelete3" onclick="editAndDelete3($(this))"  flowId="'+ res.obj[i].flowId + '" runId="'+ res.obj[i].runId + '">删除</a>'
                    }else{
                        var str_del = '';
                    }
                    if((res.obj[i].all=='1' || res.obj[i].manage=='1') && (res.obj[i].prcsFlag==4 || res.obj[i].endTime!=undefined)){
                        var str_handleRe = '<a style="margin-right: 10px" data-i="0" href="javascript:;" class="editAndDelete4" onclick="editAndDelete4($(this))"  flowId="'+ res.obj[i].flowId + '" runId="'+ res.obj[i].runId + '">恢复执行</a>'
                    }else{
                        var str_handleRe = '';
                    }
                    if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
                        return 0;
                    } else if (/(Android)/i.test(navigator.userAgent)) {
                        return 0;
                    }else{
                        if((res.obj[i].all=='1' || res.obj[i].edit=='1')&&res.obj[i].endTime != undefined){
                            var str_edit = '<a style="margin-right: 10px" data-i="0" href="javascript:;" class="editAndDelete5" onclick="editAndDelete5($(this))"  flowId="'+ res.obj[i].flowId + '" runId="'+ res.obj[i].runId + '">编辑</a>'
                        }else{
                            var str_edit = '';
                        }
                    }
                    str +=  '<tr>\
                                <td style="width: 29.915000000000003px"><input type="checkbox" name="checkbox" class="kx"></td>\
                                <td style="width: 89.9px">'+ res.obj[i].runId +'</td>\
                                <td style="width: 336.35px"><a class="wenhao" style="cursor: pointer;" href="javascript:void(0);" onclick="js_method($(this))" title="'+ res.obj[i].runName +'" runid="'+ res.obj[i].runId +'" flowid="'+ res.obj[i].flowId +'" prcsid="1" flowstep="1">'+ res.obj[i].runName +'</a></td>\
                                <td style="width: 234.04999999999998px">'+ res.obj[i].beginTime +'</td>\
                                <td style="width: 234.04999999999998px"><a class="wenhao" style="cursor: pointer;" onclick="bzlct($(this))" runid="8050" flowid="144">无</a></td>\
                                <td style="width: 111.6px">'+ res.obj[i].status +'</td>\
                                <td style=""><a style="margin-right: 10px" data-i="0" href="javascript:;" class="editAndDelete0" onclick="editAndDelete0($(this))"  flowId="'+ res.obj[i].flowId + '" runId="'+ res.obj[i].runId + '">流程图</a></td>\
                            </tr>';
                }
                $('#pageTbody').html(str);
                $('#boxform').hide();
                $('#toolbar').show();
                $('#pagediv').show();
                if(cb){
                    cb(res.totleNum);
                }
            }
        })
    }
    //点击跳转查看详情页面
    function js_method(e){
        var flowId = e.attr('flowid');
        var runId = e.attr('runid');
        window.open('/workflow/work/workformPreView?flowId='+ flowId +'&flowStep=&runId='+ runId +'&prcsId=')
    }
    function backTo(){
        $('#boxform').show();
        $('#toolbar').hide();
        $('#pagediv').hide();
    }
    /***************点击流程图******************************/
    function editAndDelete0(e){
        var flowid = e.attr('flowid');
        var runid = e.attr('runid');
        window.open('/flowSetting/processDesignToolTwo?flowId='+ flowid +'&rilwId='+runid);
    }

    /***************点击结束******************************/
    function editAndDelete1(e){
        var flowid = e.attr('flowid');
        var runid = e.attr('runid');
        window.open('/flowSetting/processDesignToolTwo?flowId='+ flowid +'&rilwId='+runid);
    }


    function dateChange(opt,flag){
        /******今天********/
        var date1 = new Date();
        date1.setTime(date1.getTime());
        /******昨天********/
        var date2 = new Date();
        date2.setTime(date2.getTime()-24*60*60*1000);
        /******本周********/
        var date3 = new Date();
        var WeekFirstDay=new Date(date3-(date3.getDay()-1)*86400000);
        var WeekLastDay=new Date((WeekFirstDay/1000+6*86400)*1000);
        /******上周********/
        var PrevFirstDay=new Date(WeekFirstDay - 7*24*60*60*1000);
        var PrevLastDay=new Date(WeekLastDay - 7*24*60*60*1000);
        /******本月********/
        var date4=new Date();
        var MonthFirstDay=new Date(date4.getFullYear(),date4.getMonth(),1);
        var MonthNextFirstDay=new Date(date4.getFullYear(),date4.getMonth()+1,1);
        var MonthLastDay=new Date(MonthNextFirstDay-86400000);
        /******上月********/
        var nowdays = new Date();
        var year = nowdays.getFullYear();
        var month = nowdays.getMonth();
        if (month == 0) {
            month = 12;
            year = year - 1;
        }
        if (month < 10) {
            month = "0" + month;
        }
        var firstDay = year + "-" + month + "-" + "01";// 上个月的第一天
        var myDate = new Date(year, month, 0);
        var lastDay = year + "-" + month + "-" + myDate.getDate();// 上个月的最后一天

        if(flag==1){
            var prcs_date1 = document.form1.prcsDate1;
            var prcs_date2 = document.form1.prcsDate2;
        }else{
            var prcs_date1=document.form1.endDate1;
            var prcs_date2=document.form1.endDate2;
        }
        switch(opt){
            case '1':
                prcs_date1.value=date1.getFullYear()+"-" + (date1.getMonth()+1) + "-" + date1.getDate();
                prcs_date2.value=date1.getFullYear()+"-" + (date1.getMonth()+1) + "-" + date1.getDate();
                break;
            case '2':
                prcs_date1.value=date2.getFullYear()+"-" + (date2.getMonth()+1) + "-" + date2.getDate();
                prcs_date2.value=date2.getFullYear()+"-" + (date2.getMonth()+1) + "-" + date2.getDate();
                break;
            case '3':
                prcs_date1.value=WeekFirstDay.getFullYear()+"-" + (WeekFirstDay.getMonth()+1) + "-" + WeekFirstDay.getDate();
                prcs_date2.value=WeekLastDay.getFullYear()+"-" + (WeekLastDay.getMonth()+1) + "-" + WeekLastDay.getDate();
                break;
            case '4':
                prcs_date1.value=PrevFirstDay.getFullYear()+"-" + (PrevFirstDay.getMonth()+1) + "-" + PrevFirstDay.getDate();
                prcs_date2.value=PrevLastDay.getFullYear()+"-" + (PrevLastDay.getMonth()+1) + "-" + PrevLastDay.getDate();
                break;
            case '5':
                prcs_date1.value=MonthFirstDay.getFullYear()+"-" + (MonthFirstDay.getMonth()+1) + "-" + MonthFirstDay.getDate();
                prcs_date2.value=MonthLastDay.getFullYear()+"-" + (MonthLastDay.getMonth()+1) + "-" + MonthLastDay.getDate();
                break;
            case '6':
                prcs_date1.value=firstDay;
                prcs_date2.value=lastDay;
                break;
        }
    }
    function seniorQuery(){
        location.href = '/flowRunPage/allsearch'
    }
    function dataShowHide(){
        if(document.getElementById("queryItem").style.display=="")
            document.getElementById("queryItem").style.display="none";
        else
            document.getElementById("queryItem").style.display="";
    }
    function searchFormData(FLOW_ID){
        $.ajax({
            url:'/form/getForm?flowId='+FLOW_ID,
            data:{},
            type:'get',
            dataType:'json',
            success:function(res){
                var html = res.obj.printModel;
                $('.hideenHTML').html(html);
                var arr = [];
                var $form_item = $('.hideenHTML').find(' .form_item');
                var length = $form_item.length;
                var str = '';
                var str1 = '';
                var xmacro = 'xmacro';
                for(var i=0;i<length;i++){
                    var name = $form_item.eq(i).attr('name');
                    var title = $form_item.eq(i).attr('title');
                    var nameNum = name.split('DATA_')[1];
                    str += '<option value="frd.'+ name +'">['+ title +']</option>';
                    str1 += '<tr>\
                               <td nowrap="" class="TableData" style="text-indent: 15px"><label for="relation_'+ nameNum +'">['+ nameNum +'] '+ title +'：</label></td>\
                               <td nowrap="" class="TableData" colspan="2">\
                                   <select style="width:200px;height:23px;" id="relation_20" name="relation_'+ nameNum +'" class="form-control" onchange="hide_item(this,'+xmacro+');">\
                                        <option value="1">等于</option>\
                                        <option value="6">不等于</option>\
                                        <option value="7">开始为</option>\
                                        <option value="8" selected="">包含</option>\
                                        <option value="9">结束为</option>\
                                        <option value="10">为空</option>\
                                   </select>&nbsp;\
                                   <input style="width: 300px;height: 20px" id="DATA_'+ nameNum +'" name="DATA_'+ nameNum +'" type="text" size="30" class="form-control">\
                               </td>\
                            </tr>';
                    var object = {
                        'key':name,
                        'value':title
                    };
                    arr.push(object);
                };
                $('#statistics_hide').append(str);
                $('#sort').append(str);
                $('#queryItem').html(str1);
//                .append('<tr>\
//                <td nowrap="" class="TableData" style="text-indent: 15px"><h6><label for="condFormula">表单字段条件公式：</label></h6></td>\
//                <td nowrap="" class="TableData" colspan="2">\
//                <p><input type="text" style="width:200px;height: 20px;" id="condFormula" name="condFormula" value="" size="35" class="form-control">&nbsp;形如：([1] or [2]) and [3]</p>\
//                </td>\
//                </tr>');

            }
        })
    }
    $(function(){
        var data={
            page:1,
            pageSize: 10,
            useFlag: true
        }
        $('.page-bottom-inner-layer').height(document.documentElement.clientHeight- 225);
        var FLOW_ID =$.getQueryString("FLOW_ID");
        $('#flowId').val(FLOW_ID);
        searchFormData(FLOW_ID);
    })
</script>
</body>
</html>